package edu.sctu.zhoudie.mouth201505.day20150518;

/**
 * Created by user08 on 2015/5/18.
 */
public class TextMore {

    public Teacher[] teacher;

    public TextMore(Teacher[] teacher) {
        this.teacher = teacher;

    }

    public void sotrNumber() {
        Teacher[] teacherA = new Teacher[teacher.length];
        for (int i = 0; i < teacher.length - 1; i++) {
            for (int j = 0; j < teacher.length - 1; j++) {
                if (teacher[j].number > teacher[j + 1].number) {
                    teacherA[0] = teacher[j];
                    teacher[j] = teacher[j + 1];
                    teacher[j + 1] = teacherA[0];
                }
            }

        }
    }

    public void sortStudent(Student[] student) {
        Student[] studentA = new Student[teacher.length];
        for (int i = 0; i < student.length - 1; i++) {
            for (int j = 0; j < student.length - 1; j++) {
                if (student[j].number > student[j + 1].number) {
                    studentA[0] = student[j];
                    student[j] = student[j + 1];
                    student[j + 1] = studentA[0];
                }
            }

        }
    }

    public Teacher pritCoded() {
        Teacher returnTeacher = null;
        System.out.println("职称为教授：");

        for (Teacher teacher : this.teacher) {
            if (teacher.profession.equals("教授")) {
                returnTeacher = teacher;
                System.out.println(returnTeacher.name + " " + returnTeacher.profession);
            }
        }
        return returnTeacher;

    }


}
